Skip to content

checkout: resolve remote stack by branch name - #477

Open
skarim wants to merge 2 commits into
skarim/checkout-from-current-local-branchfrom
skarim/checkout-by-remote-branch-name
Open

checkout: resolve remote stack by branch name#477
skarim wants to merge 2 commits into
skarim/checkout-from-current-local-branchfrom
skarim/checkout-by-remote-branch-name

Conversation

@skarim

@skarim skarim commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

When gh stack checkout <branch> doesn't find a locally tracked stack, it now looks for a matching branch in active stacks on remote. A match is imported through the existing PR checkout flow and switches to the requested branch.

Local matches and existing stack/PR-number precedence are unchanged. Multiple remote matches fail with guidance to use a stack or PR number. Branches that aren't part of a stack remain unsupported.


Stack created with GitHub Stacks CLIGive Feedback 💬

Copilot AI balanced review requested due to automatic review settings August 25, 2026 03:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds remote branch-name resolution to gh stack checkout, closing #427.

Changes:

  • Resolves local branches first, then active remote stacks.
  • Handles ambiguity and numeric branch names.
  • Updates tests and documentation.
Show a summary per file
File Description
cmd/checkout.go Adds remote branch resolution.
cmd/checkout_test.go Tests success, ambiguity, and API errors.
README.md Documents remote branch checkout.
docs/src/content/docs/reference/cli.md Updates CLI reference.
skills/gh-stack/SKILL.md Removes the local-only limitation.
skills/gh-stack/references/commands.md Updates checkout constraints.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 6/6 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread cmd/checkout.go
Comment thread cmd/checkout.go Outdated
@skarim skarim self-assigned this Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support gh stack checkout <branch> for branches that only exist on remote

2 participants